#include<iostream>

using namespace std;

struct X;

struct Y{
    void f(X*);
};

struct X{   //definition
private:
    int i;
public:
    void initialize();
    friend void g(X*,int );   //Global friend
    friend void Y::f(X*);     //Struct member friend
    friend struct Z;          //Entire struct is a friend
    friend void h();
};

void X::initialize()
{
    i=0;
}

void g(X* x, int i)
{
    x->i=i;
}

void Y::f(X* x)
{
    x->i=47;
}

struct Z{
private:
        int j;
}

int main()
{
